import request from '@/utils/request'

// 查询增氧机列表
export function listWater(query) {
  return request({
    url: '/system/water/list',
    method: 'get',
    params: query
  })
}

// 查询增氧机详细
export function getWater(waterId) {
  return request({
    url: '/system/water/' + waterId,
    method: 'get'
  })
}

// 新增增氧机
export function addWater(data) {
  return request({
    url: '/system/water',
    method: 'post',
    data: data
  })
}

// 修改增氧机
export function updateWater(data) {
  return request({
    url: '/system/water',
    method: 'put',
    data: data
  })
}

// 增氧机数据权限
export function dataScope(data) {
  return request({
    url: '/system/water/dataScope',
    method: 'put',
    data: data
  })
}

// 增氧机状态修改
export function changeWaterStatus(waterId, status) {
  const data = {
    waterId,
    status
  }
  return request({
    url: '/system/water/changeStatus',
    method: 'put',
    data: data
  })
}

// 删除增氧机
export function delWater(waterId) {
  return request({
    url: '/system/water/' + waterId,
    method: 'delete'
  })
}

// 查询增氧机已授权用户列表
export function allocatedUserList(query) {
  return request({
    url: '/system/water/authUser/allocatedList',
    method: 'get',
    params: query
  })
}

// 查询增氧机未授权用户列表
export function unallocatedUserList(query) {
  return request({
    url: '/system/water/authUser/unallocatedList',
    method: 'get',
    params: query
  })
}

// 取消用户授权增氧机
export function authUserCancel(data) {
  return request({
    url: '/system/water/authUser/cancel',
    method: 'put',
    data: data
  })
}

// 批量取消用户授权增氧机
export function authUserCancelAll(data) {
  return request({
    url: '/system/water/authUser/cancelAll',
    method: 'put',
    params: data
  })
}

// 授权用户选择
export function authUserSelectAll(data) {
  return request({
    url: '/system/water/authUser/selectAll',
    method: 'put',
    params: data
  })
}

// 根据增氧机ID查询渔场树结构
export function deptTreeSelect(waterId) {
  return request({
    url: '/system/water/deptTree/' + waterId,
    method: 'get'
  })
}
